﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CaseChoosePanel : MonoBehaviour
{
    [SerializeField] Button Case1_0;
    [SerializeField] Button Case1_2;
    [SerializeField] Button Case1_3;
    [SerializeField] Button Case1_4;
    [SerializeField] Button Case1_5;
    [SerializeField] Button Case1_6;
    [SerializeField] Button Case1_7;
    [SerializeField] Button Case1_8;

    private void Awake()
    {
        EventManager.Add("CaseChoosePanel_UpdateUI", UpdateUI);
    }

    public void UpdateUI(params object[] o)
    {
        Case1_0.interactable = SaveData._.CasePass["Case1-0"];
        Case1_2.interactable = SaveData._.CasePass["Case1-2"];
        Case1_3.interactable = SaveData._.CasePass["Case1-3"];
        Case1_4.interactable = SaveData._.CasePass["Case1-4"];
        Case1_5.interactable = SaveData._.CasePass["Case1-5"];
        Case1_6.interactable = SaveData._.CasePass["Case1-6"];
        Case1_7.interactable = SaveData._.CasePass["Case1-7"];
        Case1_8.interactable = SaveData._.CasePass["Case1-8"];
    }

    private void OnDestroy()
    {
        EventManager.Reomve("CaseChoosePanel_UpdateUI", UpdateUI);
    }

    public void GoCase(string CaseName)
    {
        LoadScene_Async.LoadScene(CaseName);
    }
}
